    //
//  CustomNavBar.m
//  NBANews
//
//  Created by Liccon Chang on 11-1-17.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "CustomNavBar.h"


static UIImage *barImage = nil;
static UIImage *logoImage = nil;

@implementation UINavigationBar (CustomImage)

- (void) drawRect: (CGRect)rect {
	[self setImage:@"top_bg.png" LogoImage:@"nba_logo.png"];
	CGRect frame;
    if (barImage != nil) {
		frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
        [barImage drawInRect:frame];
        [barImage release];
        barImage = nil;
    }
	if (logoImage != nil) {
		frame = CGRectMake(self.frame.size.width - logoImage.size.width - 10, 0, logoImage.size.width, self.frame.size.height);
        [logoImage drawInRect:frame];
        [logoImage release];
        logoImage = nil;
    }
}

- (void) setImage: (NSString *)image LogoImage:(NSString*)aLogo {
    barImage = [ UIImage imageNamed:image];
	logoImage = [ UIImage imageNamed:aLogo];
    [self setNeedsDisplay];
}

@end
